#ifndef POINT_H
#define POINT_H

#include "vector.h"

class Point
{
public:
    Point();
    Point(double x, double y, double z);
    Point(const Point &p);
    ~Point();

    Point& operator=(const Point &p);
    Vector toVector() const {
        return Vector(elements[0], elements[1], elements[2]);
    }

    inline double& operator()(int i) {
        return elements[i];
    };

    inline double operator()(int i) const {
        return elements[i];
    };

    const double* toCArray() const {
        return elements;
    }

    void sum(const Vector &v) {
        elements[0] += v(0);
        elements[1] += v(1);
        elements[2] += v(2);
    }

private:
    double elements[4];
    void copy(const Point &p);
};

Point operator+(const Point &p, const Vector &v);
Vector operator-(const Point &p1, const Point &p2);
double operator*(const Point &left, const Vector &right);
double operator*(const Vector &left, const Point &right);
#endif // POINT_H
